home *** CD-ROM | disk | FTP | other *** search
Modula Implementation | 1994-01-27 | 1.5 KB | 61 lines |
- IMPLEMENTATION MODULE AMGraphics;
-
- (* AMGraphics does all the interactive graphics work required during
- program execution, including poltting an automata, printing message
- outputs, and accepting input.
-
- Version 2.0A by Mike Dryja February 21, 1987 *)
-
- FROM SYSTEM IMPORT ADR;
- FROM AMCalc IMPORT MaxAutomata, Range, SeeCell, CellType, Automata,
- GetLength;
- FROM AMSetUp IMPORT AMWindow;
- FROM Devices IMPORT CloseDevice, OpenDevice;
- FROM IO IMPORT DoIO, CmdRead, CmdWrite, IOStdReq, IORequest;
- FROM Strings IMPORT Length;
- FROM Pens IMPORT RectFill, SetAPen, SetBPen, SetDrMd, WritePixel;
- FROM Rasters IMPORT ScrollRaster;
- FROM Intuition IMPORT WindowPtr, Window;
- FROM GraphicsLibrary
- IMPORT Jam1;
- VAR
- Y,
- YMax : CARDINAL;
-
- PROCEDURE PreparePlot ();
- BEGIN
- SetAPen(AMWindow^.RPort^, 0);
- SetBPen(AMWindow^.RPort^, 0);
- SetDrMd(AMWindow^.RPort^, Jam1);
- RectFill(AMWindow^.RPort^, 2, 12, 318, 198);
- Y := 12;
- END PreparePlot;
-
- PROCEDURE SetScroll (Scroll : ScrollType);
- BEGIN
- IF Scroll = Smooth THEN
- YMax := 198;
- ELSE
- YMax := 180;
- END;
- END SetScroll;
-
- PROCEDURE PlotAutomata (State : Automata);
- VAR
- X : CARDINAL;
- BEGIN
- IF Y = 200 THEN
- ScrollRaster(AMWindow^.RPort^, 0, (200 - YMax), 2, 12, 318, 198);
- Y := YMax;
- END;
- FOR X := 1 TO GetLength () DO
- SetAPen(AMWindow^.RPort^, SeeCell(State, X));
- WritePixel(AMWindow^.RPort^, (X * 2), Y);
- END;
- INC (Y, 2);
- END PlotAutomata;
-
- BEGIN
- Error := FALSE;
- END AMGraphics.
-